﻿using System.Collections.Generic;
using System.IO;

namespace DiskUsage
{
    public abstract class DirectoryPresentationBase
    {
        List<DirectoryPresentationBase> m_children;

        abstract public string Name { get; }
        abstract public string Icon { get; }
        abstract public string SmallIcon { get; }
        abstract public DirectoryInfo DirectoryInfo { get; }

        public List<DirectoryPresentationBase> Children
        {
            get
            {
                try
                {
                    m_children = PopulateChildren();
                }
                catch
                {
                    //User may not have access to all the directories. 
                    m_children = new List<DirectoryPresentationBase>();
                }
                return m_children;
            }
        }

        protected abstract List<DirectoryPresentationBase> PopulateChildren();
        public abstract bool IsParentOf(DirectoryInfo dir);
    }
}
